public class DrawCard2 {
		
	public static void main(String[] args) {
		System.out.println("The value of the card is : " + getCard());
	}
		
		
	private static int getCard() {
		int value = 0;
		//Try to get a right card
		while(true) {
			//get a card
			value = (int) (Math.random() * 13 + 1);
			//is the card acceptable ?
			try {
				if (value < 7 && value != 1)
					throw new InvalidCardException();
				break;
			} catch (InvalidCardException e) {
				System.out.println(e.getMessage());
			}
		}
		return value;
	}  
}